import { AnyAction } from "redux";
import produce from "immer";

const mahjong = (
	state = {
		open: false,
		lock: false,
		deckinfo: {}, // 牌组
		baseinfo: { deck: [], partition: [], linner: {} }, // 牌型信息
		current: 1, // 页码
		mahjongs: [], // 麻将
		linners: [{}], // 出牌
	},
	action: AnyAction
) =>
	produce(state, (draftState) => {
		switch (action.type) {
			case "SET_MAJ_DATA":
				Object.assign(draftState, action.setobj);
				break;
			default:
				return draftState;
		}
	});

export default mahjong;
